﻿using BGYXControlLibrary;
using BGYXControlLibrary.Common.Layer;
using BGYXControlLibrary.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Resources;
using System.Windows.Shapes;
using static BGYXControlLibrary.BGYX_Button;

namespace MyWpfControls
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : BGYX_Window
    {
        public class User
        {
            public String name { get; set; }
            public Int32 age { get; set; }
            public Boolean sex { get; set; }
            public DateTime create_time { get; set; }
        }

        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += MainWindow_Loaded;
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.frame.Navigate(new Uri("Pages/OxyPlot/Bar1.xaml", UriKind.Relative));
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void TreeViewItem_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.frame.Navigate(new Uri((sender as TreeViewItem).Tag + ".xaml", UriKind.Relative));
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //this.ShowLoading(Icons.Loading_Load4, RotateDirection.Left);
            Task.Run(() =>
            {

                foreach (var icon in Enum.GetValues(typeof(Icons)))
                {
                    if (icon.ToString().Contains("Load"))
                    {
                        Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            this.ShowLoading((Icons)icon);
                        }));
                        Thread.Sleep(3000);
                    }
                }

            });
        }

        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            this.AlertClose();
        }
    }
}
